#+_+ coding:utf-8 +_+

## base 
ERROR_BASE = 0x100000

## login error 
ERROR_AUTH       = 0x10000

ERROR_AUTH_LOGIN = 0x1000  | ERROR_BASE
EAUTH_LOGIN_INVALIED_TOKEN =  1 | ERROR_AUTH_LOGIN
EAUTH_LOGIN_UID_ERROR      =  2 | ERROR_AUTH_LOGIN

ERROR_AUTH_UID = 0x2000
EAUTH_UID_NOTLOGIN     = 1  | ERROR_AUTH_UID

## signature error
ESIGNATURE      = 20000

## news error
ERROR_NEWS       = 0x30000

ERROR_NEWS_ID    = 0x1000 | ERROR_NEWS
ENEWS_ID_NOTVALIED  = 0x1 | ERROR_NEWS_ID

## comment error
ERROR_COMMENT    = 0x4000

ECOMMENT_ID_NOTVALIED = 0x1 | ERROR_COMMENT


errstr = dict()
errstr[EAUTH_LOGIN_INVALIED_TOKEN] = "Invalied token!"
errstr[EAUTH_LOGIN_UID_ERROR] = "Generate UID error!"
errstr[EAUTH_UID_NOTLOGIN]    = "User not login!"
errstr[ESIGNATURE]            = "Signature error!"
errstr[ENEWS_ID_NOTVALIED]    = "News's id is not valied!"
errstr[ECOMMENT_ID_NOTVALIED] = "Comment's id is not valied!"


def ErrStr(errno):
    if errstr.has_key(errno):
        return errstr[errno]
    return None
